package com.lis.mango.Config;

import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author sun
 * @create 2021-09-077:04 PM
 * 配置分页插件
 */
@Configuration
public class MybatisPlusConfig {

        // 乐观锁插件
        @Bean
        public OptimisticLockerInnerInterceptor optimisticLockerInterceptor() {
            return new OptimisticLockerInnerInterceptor();
        }

        // sql注入插件
        @Bean
        public ISqlInjector sqlInjector(){
            return new DefaultSqlInjector();
        }

        // 分页插件
        @Bean
        public PaginationInnerInterceptor paginationInterceptor() {
            return new PaginationInnerInterceptor();
        }

}
